//
// Created by PC on 2023/10/9.
// 汉诺塔递归
// https://www.bilibili.com/video/BV1AD4y1k7pb/?spm_id_from=333.337.top_right_bar_window_history.content.click
//



#include <iostream>
using namespace std;

int cnt;

void move(int id, char from, char to) // 打印移动方式：编号，从哪个盘子移动到哪个盘子
{
    printf ("step %d: move %d from %c->%c\n", ++cnt, id, from, to);
}

void hanoi(int n, char x, char y, char z)
{
    if (n == 0)
        return;
    hanoi(n - 1, x, z, y);
    printf ("step %d: move %d from %c->%c\n", ++cnt, x,z);
//    move(n, x, z);
    hanoi(n - 1, y, x, z);
}

int main()
{
    int n;
    cnt = 0;
    scanf ("%d", &n);
    hanoi(n, 'A', 'B', 'C');
    return 0;
}